<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>主页</title>

  <link rel="stylesheet" href="/statics/css/bootstrap.min.css">
  <link rel="stylesheet" href="/statics/css/users.css">
  <link rel="stylesheet" href="../layui/css/layui.css">
  <!-- 网页icon头像 -->
  <link rel="shortcut icon" href="/statics/img/tianqi.png">

</head>

<body>
  <div id="container">

    <div class="row">
      <!-- 左布局 -->
      <div class="col">

      </div>
      <!-- 中间布局 -->
      <div class="col">

        <div class="layui-collapse" lay-accordion>
          <div class="layui-colla-item">
            <h2 class="layui-colla-title"><strong>调查问卷</strong></h2>

            <div class="layui-colla-content layui-card">
              {% for qoe in questionnairesAll %}
              <div class="layui-card">
                <div class="layui-card-header">
                  <h3>{{qoe.qsName}}</h3>
                </div>
                <div class="layui-card-body">
                  <div style="word-break:break-all">
                    {{qoe.qsSynopsis}}
                  </div>
                  <br>
                  <label for="" style="margin-left: 18rem;">创建的人：{{qoe.publishUserName}}</label>
                  <label for="" style="margin-left: 19rem;">编号：{{qoe.id}}</label>
                  <input type="button" name="" id="" value="前往" onclick="QS1('{{qoe.id}}')"
                    class="layui-btn layui-btn-radius layui-btn-normal" style="margin-left: 23rem;margin-top: 1rem;">
                </div>
              </div>
              <hr>
              {% endfor %}
            </div>

          </div>
        </div>

      </div>

      <!-- 右布局 -->
      <div class="col">
        <div class="card" style="width: 18rem;">
            <li class="list-group-item" id="introductionColumn">用户：{{username}}</li>
            <a href="#" class="card-link btn btn-info" style="margin: 1rem;" onclick="createQS()">创建调查问卷</a>
            <a href="/home/fillInQS" class="card-link btn btn-info" style="margin: 1rem;">填写的问卷</a>
          </ul>
          <div class="card-body">
            <!-- 注销 -->
            <a href="#" onclick="logOff()" class="card-link btn btn-secondary" style="margin: 1rem;">注销</a>
          </div>
        </div>
      </div>
    </div>
  </div>
  </div>



  <script src="/statics/js/jquery-3.6.0.min.js"></script>
  <!-- axios -->
  <script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>

  <script src="/statics/js/bootstrap.min.js"></script>
  <script src="../layui/layui.js"></script>
  <script>
    layui.use(['layer', 'form'], function () {
      var layer = layui.layer
        , form = layui.form;
    });
  </script>

  <script>
    // 创建调查问卷按钮
    function createQS() {
      window.location.href = "/home/publishQS"
    }





    // 注销按钮点击事件
    function logOff() {
      axios({
        method: 'post',
        url: '/logout'
      }).then(function (response) {
        // axios工具下，服务器真正返回的数据在返回对象的data中
        var res = response.data;
        if (res.code === 200) {
          window.location.href = '/';
        }
      })
    }
  </script>

 

  <!-- 问卷一按钮 -->
  <script>
    // 点击前往的问卷Id
    // var currentQSId = '';
    //     function QS1(qoeId) {
    //       currentQSId = qoeId;
    //     }

    var QS1 = function (qoeId) {
      axios({
        method: 'post',
        url: '/home/SQJudge',
        data: {
          qoeId
        }
      }).then(function (response) {
        var res = response.data;
        if (res.code === 200) {
        window.location.href = "/home/SQ1";          
        }
      })
      console.log(qoeId);

    }
  </script>


</body>


</html>